/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.wors.android.multirideshare.util.listener;

import android.view.View;
import cz.wors.android.multirideshare.activity.RideShareActivity;
import cz.wors.android.multirideshare.model.BooleanMesssage;

	public class DeleteContactListener implements View.OnClickListener 
	{
		// musi se pricist k startovnimu ID
		public String name;
		RideShareActivity a;
		
		public DeleteContactListener(RideShareActivity a, String name)
		{
			this.name = name;
			this.a = a;
		}
		
		public void onClick(View v) 
		{
			//showToast("Smažu kontakt se jménem "+name, false);
			
			a.getDb().open();
			BooleanMesssage deleted = a.getDb().deleteDriver(name, true);
			a.getDb().close();
			
			a.showToast(deleted.getMsg());
			
			if (deleted.isOK()) {
				a.generateSettings();
			}
			
			a.popup_window.dismiss();
		}
	}
